from django.urls import path, re_path
from .views import LoginView, TestView, ProductDetailView, ShopCarsView, PeoductTypeListView, CouponFindView, \
    AddressView, SettlementView, AddProduct

urlpatterns = [
    path('login', LoginView.as_view()),
    path('testview', TestView.as_view()),
    # 商品列表
    path('product_list', PeoductTypeListView.as_view()),
    # 商品详情
    re_path(r'productDetail/(?P<pk>\d?)', ProductDetailView.as_view({'get': 'retrieve'})),
    # 购物车查询，增加
    path('shopcars_list', ShopCarsView.as_view({'get': 'retrieve', 'post': 'create'})),
    # 购物车更新，删除
    re_path(r'shopCarsList/(?P<pk>\d?)', ShopCarsView.as_view({'put': 'update', 'delete': 'destroy'})),
    # 优惠券查询
    path('coupon_find', CouponFindView.as_view()),
    # 地址接口
    path('address', AddressView.as_view()),

    # 下单
    path('settlement', SettlementView.as_view()),

    # 商品新增
    path('addproduct', AddProduct.as_view())
]
